﻿using System;
using System.IO;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Media;

using SBPweb.Modules.Modularity;

using SBPweb.MediaCenter.Tools.WPF.Extenders;

using SBPweb.MediaCenter.Modules.Viewer.WPF.Controls;

namespace SBPweb.MediaCenter.Modules.Viewer.WPF
{
    public class Module : Viewer.Module
	{

		#region Private members

		private static CultureInfo[] SUPPORTED_CULTURES = new CultureInfo[] { new CultureInfo("hu-HU"), new CultureInfo("en-US") };

		#endregion

		#region Constructor logic

		public Module(IModuleHost parent)
			: base(parent)
        {
        }

		#endregion

        #region Property accessors

        public new Controllers.ViewerService Viewer
        {
            get
            {
                return base.Viewer as Controllers.ViewerService;
            }
            protected set
            {
                base.Viewer = value;
            }
        }

        #endregion

        #region Initialization logic

        public override void InstantiateServices()
        {
            base.InstantiateServices();
            this.Viewer = new Controllers.ViewerService(this);
        }

        public override void Initialize()
        {
            base.Initialize();

            if (HostType != ModuleHostType.WindowsPresentationFoundation)
            {
                //TODO: log something
                return;
            }
        }

        public override void InitializeMenus()
        {
            //Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SBPweb.MediaCenter.Modules.Viewer.WPF.Resources.3D-Free-Model-008.3ds");
            //MenuItem mItem = new MenuItem(stream);// @"c:\Users\Laci\Projects\SBPweb\SBPweb.MediaCenter\Artwork\Ringwave.3DS");
            //mItem.BackgroundColor = Color.FromRgb(0, 148, 180);
            //Host.Menu.Add(mItem);
            MainMenuItem mmItem = new MainMenuItem();
            mmItem.BackgroundColor = Color.FromRgb(0, 148, 180);
            mmItem.ParentModule = this;
            pHost.Menu.Add(mmItem);
        }

        public override void InitializeSmartparts()
        {
            ViewerMain vm = new ViewerMain(this);
            pHost.Smartparts.Add(vm);
            this.Viewer.ViewerViewControl = vm;
        }

        #endregion

        #region Calling the methods... (Not implemented!)
        /*
        public override void Open(Uri uri)
		{
			throw new NotImplementedException();
		}

		protected override void ReopenImage()
		{
			throw new NotImplementedException();
		}

		protected override void CloseImage()
		{
			throw new NotImplementedException();
		}

		protected override void SaveImage(string filePath)
		{
			throw new NotImplementedException();
		}

		protected override void SaveImagePart(string filePath)
		{
			throw new NotImplementedException();
		}

		protected override void Move(SBPweb.MediaCenter.Modules.Viewer.ModifyDescriptors.MoveDirections direction)
		{
			throw new NotImplementedException();
		}

		protected override void Rotate(SBPweb.MediaCenter.Modules.Viewer.ModifyDescriptors.RotateDeg deg)
		{
			throw new NotImplementedException();
		}

		protected override void Flip(SBPweb.MediaCenter.Modules.Viewer.ModifyDescriptors.FlipAxis axis)
		{
			throw new NotImplementedException();
		}

		protected override void Zoom(SBPweb.MediaCenter.Modules.Viewer.ModifyDescriptors.ZoomStyles zoom)
		{
			throw new NotImplementedException();
		}

		protected override void NextImage()
		{
			throw new NotImplementedException();
		}

		protected override void PreviousImage()
		{
			throw new NotImplementedException();
		}

		protected override void SlideShowStart()
		{
			throw new NotImplementedException();
		}

		protected override void SlideShowStop()
		{
			throw new NotImplementedException();
		}
        */
		#endregion

        public override void LoadPersistency()
        {
            throw new NotImplementedException();
        }

        public override void SavePersistency()
        {
            throw new NotImplementedException();
        }

        public override void Terminate()
        {
            //throw new NotImplementedException();
        }
    }
}
